Overview
The supplementary material includes three parts of code. The first part comprises Python scripts for generating demographic features and the API call function used to communicate with LLMs. This script facilitates the dynamic interaction with the LLMs by embedding demographic features into the communication process.
The second part calculates the ranges of two key parameters, Sigma and Alpha, which are used to understand decision-making behaviors under risk and uncertainty. The calculations are based on a series of inequalities derived from financial decision-making models. The results are stored in two CSV files: sigma_results.csv and alpha_results.csv. The calculation of Lambda are based on excel, the formula and results are stored in data.xlsx.
The third part consists of a Stata script designed to perform data analysis on three different models: GPT-4, Claude, and Gemini. The analysis process involves importing data from an Excel file, cleaning and encoding the data, generating descriptive statistics, and conducting regression analyses on three parameters: Sigma (risk preference), Alpha (probability weighting), and Lambda (loss aversion). This script is adept at handling both baseline data and data with embedded demographic features, enabling a comprehensive evaluation of the models' behaviors under varied conditions.
Dependencies
* Python 3.9 or newer
  - openai
  - anthropic
  - google-generativeai
  - Pandas
  - numpy
* Stata software installed on your system.
* The Excel file data.xlsx located in the specified directory.
* Ensure necessary permissions and libraries are enabled in your Stata environment to run import excel.

Sampling and API Code Usage:
Directory Structure:
Place all downloaded .py files in the same directory.
Script Description:
1. Generate Feature Samples: Use the feature generation code starting with the prefix "profile" to generate target feature sets for your group of interest.
2. Execution of API: Use the Python script with the prefix "api." Set up API keys based on your credentials, and use the corresponding LLM API to start the session and record the answers.

Parameter Calculation Code Usage:
Description of the Code
1. Define Symbolic Variables: The code starts by defining the symbolic variables Sigma and Alpha using the sympy library.
2. Define Inequalities: Several inequalities are defined using symbolic expressions. These inequalities involve terms related to risk preferences and probabilities.
3. Series Values: Two series of values are provided, which are used in the inequalities to represent different financial outcomes.
4. Prepare Matrices: Matrices (sigma_results and alpha_results) are initialized to store the results. The results will indicate the valid ranges of Sigma and Alpha for each combination of series values.
5. Create Meshgrid: A meshgrid of Sigma and Alpha values is created using numpy to evaluate the inequalities over a range of possible values.
6. Convert Symbolic Expressions to Numerical Functions: The inequalities are converted to numerical functions using sympy.lambdify for efficient computation.
7. Evaluate Inequalities: The code evaluates the inequalities over the meshgrid to determine the valid ranges of Sigma and Alpha for each combination of series values.
8. Store Results: The valid ranges of Sigma and Alpha are stored in the sigma_results and alpha_results matrices.
9. Export Results to CSV: The results are converted to pandas DataFrames and exported to CSV files.
Usage
1. Set Up: Ensure you have the necessary libraries installed and the code file is placed in a suitable directory.
2. Run the Code: Execute the script in your Python environment. The script will generate two CSV files (sigma_results.csv and alpha_results.csv) containing the valid ranges of Sigma and Alpha.
3. Access Results: The CSV files will be saved in the specified directory. Each file will contain the ranges of Sigma and Alpha for different combinations of series values.
Customization
* Series Values: You can modify the series_1_right2 and series_2_right2 lists to use different series values as needed.


Analysis Code Usage:
Directory Structure
Ensure the data.xlsx file is placed in the directory. 
Script Description
1. Set Working Directory
The script starts by setting the working directory to the location of the data file.
2. Import and Clean Data
The data is imported from different sheets within the Excel file data.xlsx. The script drops rows where the Feature variable is missing and generates descriptive statistics for the parameters Sigma, Alpha, and Lambda.
3. Encode Categorical Variables
Categorical variables such as Gender, Education, Marital Status, Location, and Age are encoded to numerical values for regression analysis.
4. Create Group Variables
New group variables are generated based on age and education levels to simplify the regression analysis.
5. Run Regressions
Regressions are run for each parameter (Sigma, Alpha, Lambda) using the encoded categorical variables. The results are stored for later comparison.
6. Repeat for Claude and Gemini Models
The same steps are repeated for the Claude and Gemini models with and without demographic features.
How to Run the Script
1. Set Up: Place the data.xlsx file in the specified directory. Open Stata and set the working directory to the location of the script and data file.
2. Run the Script: Copy and paste the script into the Stata command window or run it as a .do file.
3. View Results: The script will output descriptive statistics and regression results to the Stata Results window. Stored regression results can be accessed using the estimates command.

